#ifndef OSGGRAPHICVIEW_H
#define OSGGRAPHICVIEW_H
/*HXF*/

#include <amk3/amk3.h>
#include <QQuickView>
#include <osgViewer/Viewer>

class OsgGraphicsContextAdapter;
class AMK_API OsgGraphicView : public QQuickView
{
    Q_OBJECT
public:
    OsgGraphicView();
    //设置场景节点
    void setScene(osg::Node* n);

    virtual void init();
    virtual void render();
	
	void SetGraphicsViewport(int w, int h);

	void SetFovNearFar(float fov, float near, float far);

protected slots :
    virtual void beforeRendering();
    virtual void afterRendering();
protected:
    osg::ref_ptr<osgViewer::Viewer> _viewer;
    OsgGraphicsContextAdapter* _context;
    osg::ref_ptr<osg::Node> _node;
    //bool _stereo;

	float _fov;
	float _near;
	float _far;
	int _viewport_width;
	int _viewport_height;

    // QWindow interface
protected:
    void resizeEvent(QResizeEvent *);
    void mousePressEvent(QMouseEvent *);
    void mouseReleaseEvent(QMouseEvent *);
    void mouseMoveEvent(QMouseEvent *);
    void wheelEvent(QWheelEvent *);
    void mouseDoubleClickEvent(QMouseEvent *);
};



#endif // OSGGRAPHICVIEW_H
